import {configureStore} from "@reduxjs/toolkit";
import {useSelector,TypedUseSelectorHook,useDispatch,shallowEqual} from "react-redux";

import counterReducer from "./modules/counter";
import recommandReducer from "../views/discover/c-views/recommand/store";
import playerReducer from "../views/player/store";

const store = configureStore({
    reducer:{
        counter:counterReducer,
        recommand:recommandReducer,
        player:playerReducer
    }
});

export type RootState = ReturnType<typeof store.getState>;
export type DispatchType = typeof store.dispatch;

export const useAppSelector:TypedUseSelectorHook<RootState> = useSelector;
export const useAppDispatch:() => DispatchType = useDispatch;
export const shallowEqualApp = shallowEqual;

export default store;
